package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt");
        while (true) {
            System.out.println("请输入想写入的内容");
            String s = sc.nextLine();
            byte[] bytes = s.getBytes();
            if ("exit".equals(s)) {
                System.out.println("结束录入");
                break;
            } else {
                fos.write(bytes);
                fos.write("\r\n".getBytes());
                System.out.println("录入成功");
                continue;
            }
        }
        fos.close();
    }
}
